package demo.springboot.Tools;

import java.text.SimpleDateFormat;
import java.util.Date;

public class time_stamp_to_date {

    // 时间戳 => 日期
    //    1648625319


    public static String timeStamp_to_Date(String seconds,String format) {
        if(seconds == null || seconds.isEmpty() || seconds.equals("null")){
            return "";
        }

        if(format == null || format.isEmpty()) format = "yyyy-MM-dd";

        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(new Date(Long.valueOf(seconds+"000")));
    }




    public static void main(String[] args) {
        String convert = timeStamp_to_Date("1648625319" , null);
        System.out.println(convert);
    }


}
